/**=========================================================
 * Directive: double-select.js
 =========================================================*/

App.directive('doubleSelect', ['Utils',
    function(utils) {
        'use strict';
        
        return {
            restrict: 'EA',
            replace: true,
            template: function($element,$attrs){
                var optionModel = $attrs.optionModel,
                    ngModel = utils.isEmpty($attrs.ngModel) ? 'doubleSelects.' + optionModel : $attrs.ngModel,
                    label1 = utils.isEmpty($attrs.label1) ? '' : $attrs.label1,
                    label2 = utils.isEmpty($attrs.label2) ? '' : $attrs.label2;
                return '\
                    <div>\
                        <label class="col-lg-1 control-label">' + label1 + '</label>\
                        <div class="col-lg-5">\
                            <simple-select multiple ng-model="' + ngModel + '.selected1" option-model="' + optionModel + '"></simple-select>\
                        </div>\
                        <label class="col-lg-1 control-label">' + label2 + '</label>\
                        <div class="col-lg-5">\
                            <simple-select multiple ng-model="' + ngModel + '.selected2" option-model="' + optionModel + '"></simple-select>\
                        </div>\
                    </div>\
                '
            }
        }
    }
]);
